package com.ruoyi.system.config;

import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author: songzy
 */
@Configuration
@EnableSwagger2
public class Knife4jConfig {
    @Bean
    public Docket docket(){
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("DerKing部分")
                .apiInfo(apiInfo())
                .select()//选择
                //可以扫描 any none 指定包  指定类  指定方法
//                .apis(RequestHandlerSelectors.basePackage("com.example"))
//                .paths(PathSelectors.ant("com.example.controller/**")) 过滤不需要扫描的路径
                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))

                .build();//创建
    }


    private ApiInfo apiInfo(){
        return new ApiInfoBuilder()
                .title("可心的kenfej文档")
                .description("我想认真读一本书")
                .version("v3.0")
                .termsOfServiceUrl("https://blog.csdn.net/weixin_58993861?type=blog")
//                .contact("程序员")
                .build();

    }
}

